﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UnvApi
{
    /// <summary>
    /// 门禁授权组信息类
    /// </summary>
    public class PermissionInfo
    {
        /// <summary>
        /// 授权组id，通过UnvVmsManager.getPermissionList方法获取
        /// </summary>
        public int? PermissionID {  get; set; }
        /// <summary>
        /// 授权组名称，通过UnvVmsManager.getPermissionList方法获取
        /// </summary>
        public string PermissionName { get; set; }
        /// <summary>
        /// 授权类型，默认为0
        /// </summary>
        public int PermissionType {  get; set; }
        /// <summary>
        /// 不知道什么Template，默认为6
        /// </summary>
        public int TemplateID {  get; set; }
        /// <summary>
        /// 该授权组内的道闸数量
        /// </summary>
        public int DoorNum {  get; set; }
        /// <summary>
        /// 该授权组的道闸列表，道闸id信息通过UnvVmsManager.getEquipmentList方法获取
        /// </summary>
        public int[] DoorList {  get; set; }
        /// <summary>
        /// 该授权组授权人员数量
        /// </summary>
        public int PersonNum {  get; set; }
        /// <summary>
        /// 该授权组授权人员列表，人员id信息通过UnvVmsManager.queryPerson方法获取
        /// </summary>
        public int[] PersonList {  get; set; }
        /// <summary>
        /// 基本构造函数，需要传入授权组id、授权组名称、授权道闸列表、授权人员列表
        /// </summary>
        /// <param name="permissionId">授权组id</param>
        /// <param name="permissionName">授权组名称</param>
        /// <param name="doorList">授权道闸列表</param>
        /// <param name="personList">授权人员列表</param>
        public PermissionInfo(int permissionId, string permissionName, int[] doorList, int[] personList)
        {
            PermissionID = permissionId;
            PermissionName = permissionName;
            PermissionType = 0;
            TemplateID = 6;
            DoorNum = doorList.Length;
            DoorList = doorList;
            PersonNum = personList.Length;
            PersonList = personList;

        }
        /// <summary>
        /// 基本构造函数，用于新增授权组时，不需传入授权组id
        /// </summary>
        /// <param name="permissionName">授权组名称</param>
        /// <param name="doorList">授权道闸列表</param>
        /// <param name="personList">授权人员列表</param>
        public PermissionInfo(string permissionName, int[] doorList, int[] personList)
        {
            PermissionName = permissionName;
            PermissionType = 0;
            TemplateID = 6;
            DoorNum = doorList.Length;
            DoorList = doorList;
            PersonNum = personList.Length;
            PersonList = personList;

        }
    }
}
